<?php if ( ! defined('APPPATH')) exit('No direct script access allowed');
/**
 *      [PinTuXiu] (C)2001-2099 ONightjar.com Pintuxiu.com.
 *      This is NOT a freeware, use is subject to license terms
 */

class category_controller extends PZ_Controller{
	
	public function __construct() {
		parent::__construct();
	}

	public function listlastlevel(){
		$api = load_api('category');
		$categories = $api->getLastLevelCategories();
		$this->ajax_success_response($categories,'');
		return;
	}
	
	public function listhottags(){
		if($cid = $this->param('cid')){
			$api = load_api('category');
			$hotwords = $api->getCategoryHotTags($cid);
			$hotwords = array_slice($hotwords,0,20);
			$this->ajax_success_response($hotwords, '');
			return;
		}
		
		$this->ajax_failed_response();
	}
	
	public function tags(){
		if($cid = $this->param('cid')){
			//$api = load_api('tag');
			//$tags = $api->getAllTagItemsByCategory($cid);
			$api = load_api('category');
			$tags = $api->getCategoryHotTags($cid);
			if($tags){
				$this->ajax_success_response($tags, '');
				return;
			}
		}
		$this->ajax_failed_response();
	}
}



